package cn.net.xyan.easy.gwt.client.model;

import cn.net.xyan.easy.gwt.shared.StringUtils;


/**
 * Created by zarra on 16/3/10.
 */
public class SortOrder {

    static public String ASC = "ASC";
    static public String DESC = "DESC";

    String column;
    String direction;

    public SortOrder(String column,String direction){
        this.column = column;
        this.direction = direction;
    }

    public SortOrder(String column){
        this(column,ASC);
    }

    public SortOrder(){

    }

    public String getColumn() {
        return column;
    }

    public void setColumn(String column) {
        this.column = column;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    @Override
    public String toString() {
        //AutoBean<SortOrder> bean = AutoBeanUtils.getAutoBean(this);
        //return AutoBeanCodex.encode(bean).getPayload();
        return StringUtils.format("{\"column\":\"{0}\",\"direction\":\"{1}\"}",column,direction);
    }
}
